#include<bits/stdc++.h>
#define gc getchar
#define pc putchar
using namespace std;
int read(){
    int x=0,f=1;
    char ch=gc();
    while(!isdigit(ch) && ch!='-')ch=gc();
    if(ch=='-'){
        f=-1;
        ch=gc();
    }
    while(isdigit(ch)){
        x=(x<<3)+(x<<1)+(ch^48);
        ch=gc();
    }
    return x*f;
}
void print(int x){
    if(x<0){
        pc('-');
        x=-x;
    }
    if(x<10){
        pc(x^48);
        return;
    }
    print(x/10);
    pc((x%10)^48);
}
int a[114514];
bool used[114514],died[114514];
int nxt[114514];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    n=read();
    for(int i=1;i<=n;i++)a[i]=read();
    sort(a+1,a+1+n);
    nxt[n]=2147483647;
    for(int i=n-1;i>=1;i--){
        if(a[i]==a[i+1])nxt[i]=nxt[i+1];
        else nxt[i]=i+1;
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(nxt[i]>n){ans=n-i+1;break;}
        died[i]=true;used[nxt[i]]=true;
        nxt[i+1]=max(nxt[i]+1,nxt[i+1]);
    }
    print(ans);
}
/*
STO TheSky233 Orz
STO LXGOD Orz
STO rym Orz
STO czx Orz
rp+=inf;
luogu_uid=1038710
STO give me 1= please Orz
*/

//15:16 too vegetable
